<template>
  <div>
    <el-table
      :data="list"
      :border="false"
      :header-cell-style="{ background: '#FAFAFA' }"
      style="width: 100%"
    >
      <el-table-column prop="title" label="考试名称"> </el-table-column>
      <el-table-column label="分数">
        <template slot-scope="{ row }"> {{ row.score }}分 </template>
      </el-table-column>
      <el-table-column label="答题时长">
        <template slot-scope="{ row }">
          {{
            row.use_time > 60
              ? (row.use_time>3600?parseInt(parseInt(row.use_time / 60)/60)+'时'+ parseInt(parseInt(row.use_time / 60)%60) +
                "分" +
                parseInt(row.use_time % 60) +
                "秒": parseInt(row.use_time / 60) +
                "分" +
                parseInt(row.use_time % 60) +
                "秒")
              : row.use_time + "秒"
          }}
        </template>
      </el-table-column>
      <el-table-column prop="create_time" label="答题时间"> </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getapplyid, getsubjectTitle } from "@/utils/auth.js";
import { mocksjList, exammyList } from "@/api/admin.js";
import { mapGetters } from "vuex";
export default {
  props: ["titleName"],
  computed: {
    ...mapGetters(["userinfor", "nickname", "adminUserId"]),
  },
  data() {
    return {
      list: [],
      subject: getsubjectTitle(),
    };
  },
  methods: {
    dataList() {
      if (this.titleName == "模拟考试统计") {
        mocksjList({ applyid: getapplyid() }).then((res) => {
          if (res.code == 200) {
            this.list = res.data.list;
          }
        });
      } else {
        exammyList({ applyid: getapplyid() }).then((res) => {
          if (res.code == 200) {
            this.list = res.data.list;
          }
        });
      }
    },
  },
  created() {
    this.dataList();
  },
};
</script>

<style lang="scss" scoped>
.li {
  padding: 0.75rem;
  background: #fff;
  font-size: 1rem;
  border-radius: 0.4rem;
  margin-top: 0.75rem;
  &:first-child {
    margin-top: 0;
  }
  .li_item {
    display: flex;
    justify-content: flex-start;
    p {
      margin: 0;
      flex: 3;
    }
    span {
      flex: 2;
      font-weight: 600;
    }
  }
  .li_content {
    line-height: 2rem;
    margin-top: 0.75rem;
    span {
      font-weight: 600;
    }
    i {
      font-size: 1rem;
    }
  }
}
</style>